<template>
  <div>
    <div>今天:{{ today.format('YYYY-MM-DD') }}</div>
    <div>下周开始日期: {{ monday }}</div>
    <div>下周结束日期: {{ sunday }}</div>
    <div>下周所有日期的数组: {{ weekDateArr }}</div>
  </div>
</template>

<script setup>
import dayjs from 'dayjs'
import 'dayjs/locale/zh-cn'
dayjs.locale('zh-cn')

const today = dayjs()
// 获取下周开始日期（将当前日期加一周，再获取轴的开始日期）
let startDateOfWeek = today.add(1, 'week').startOf('week')
let monday = startDateOfWeek.format('YYYY-MM-DD')
let sunday = startDateOfWeek.endOf('week').format('YYYY-MM-DD')
const weekDateArr = new Array(7).fill(true).map((_, idx) => startDateOfWeek.add(idx, 'day').format('YYYY-MM-DD'))
</script>
